﻿using ReflectionStudio.Core.Events;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Windows;
using System.Windows.Data;
using WPFExcelReport.Controls;
using WPFExcelReport;
using WPFExcelReport.Helpers; 
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TAM21
    { 
        
        public TAM21()
        { 
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VAMSTAMM(); 
            this.DataContext = MV;
            InitializeComponent();
            KSTKRS = "  ";
            KST = "0400";
            AMTYP = "XS".PadRight(8);
        }

        public override void OnAMKSTChg(string value)
        {
            if (AMKST.Length < 6)
                return;
            KSTKRS = AMKST.Substring(0, 2);
            KST = AMKST.Substring(2, 4);
            base.OnAMKSTChg(value);
        }
        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
            dwData = TBMain.NewRow();
            dwData["AMMANDANT"] = app.Mandant;
            dwData["AMKSTKRS"] = KSTKRS;
            dwData["AMKST"] = KST;
            dwData["AMTYP"] = AMTYP;
            SResult = TMV.QAM01(dwData);
            MergeData(SResult, true, true);
        }
    }
}